package com.ys.fmms.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.ys.fmms.mapper.DataDisplayMapper;
import com.ys.fmms.pojo.DataDisplay;

public class ExcelListener extends AnalysisEventListener<DataDisplay> {
    private DataDisplayMapper dataDisplayMapper;

    public ExcelListener(DataDisplayMapper dataDisplayMapper) {
        this.dataDisplayMapper = dataDisplayMapper;
    }

    @Override
    public void invoke(DataDisplay dataDisplay, AnalysisContext analysisContext) {
        // 将除了第一行之外的每一行读取后存入到数据库中
        dataDisplayMapper.insert(dataDisplay);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
